import time
import serial


class Status:
    def __init__(self):
        self.Run = True

def GetData(Buffer, Status, SerialObj):
    s = SerialObj
    
    
    Start = time.time()
    
    
    while Status.Run:
        #print chr(Output[0])
        #s.write(chr(Output[0]))
        Res =  ord(s.read())
        if Res == 85:
            try:
                Res =  ord(s.read())
                Slot = Res/32
                Res2 =  ord(s.read())
                Slot2 = Res2/32
                if Slot == Slot2:
                    Data = (Res - (Slot * 32)) + (32 * (Res2 - (Slot2 * 32)))
                print """Slot : %d    Data : %d"""%(Slot, Data)
                Buffer[int(Slot)] = int(Data)
            except:
                pass
        else:
            print Res
        
    print "Done"
            
            
if __name__ == '__main__':
    Buff = []
    Stat = Status()
    GetData(Buff, Stat)
    time.sleep(10)

    